package com.ego.coupon.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: ego
 * @description: Redisson相关配置
 * @author: KamTang
 * @create: 2022-12-31 09:51
 **/
@Configuration
public class RedissonConfig {

    @Value("${spring.redis.password}")
    private String password;

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://47.96.40.140:6379");
        config.useSingleServer().setPassword(password);

        return Redisson.create(config);
    }
}
